package com.fyzk.bean;

import android.graphics.Rect;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

/**
 * Created by fanxs11 on 17/6/6.
 */

public class MissValueListBean {

    public static final String MISS = "miss";
    public static final String MISS_GE = "ge";
    public static final String MISS_SHI = "shi";
    public static final String MISS_BAI = "bai";

    /**
     * errorcode : 0
     * msg : 成功
     * data : [{"lotteryType":2007,"phase":"17060612","mvData":"{\"miss\":[2,1,0,2,0,0,3,1,0,2,0]}","wincode":"03,09,05,06,11"},{"lotteryType":2007,"phase":"17060611","mvData":"{\"miss\":[1,0,0,1,0,2,2,0,5,1,0]}","wincode":"03,08,02,11,05"},{"lotteryType":2007,"phase":"17060610","mvData":"{\"miss\":[0,5,0,0,1,1,1,0,4,0,1]}","wincode":"01,03,08,10,04"},{"lotteryType":2007,"phase":"17060609","mvData":"{\"miss\":[1,4,1,2,0,0,0,2,3,0,0]}","wincode":"05,10,06,11,07"},{"lotteryType":2007,"phase":"17060608","mvData":"{\"miss\":[0,3,0,1,1,0,4,1,2,0,0]}","wincode":"06,11,10,03,01"},{"lotteryType":2007,"phase":"17060607","mvData":"{\"miss\":[2,2,0,0,0,1,3,0,1,3,0]}","wincode":"08,04,05,03,11"},{"lotteryType":2007,"phase":"17060606","mvData":"{\"miss\":[1,1,0,1,1,0,2,0,0,2,0]}","wincode":"08,09,03,11,06"},{"lotteryType":2007,"phase":"17060605","mvData":"{\"miss\":[0,0,1,0,0,3,1,1,2,1,0]}","wincode":"05,02,01,11,04"},{"lotteryType":2007,"phase":"17060604","mvData":"{\"miss\":[1,3,0,2,2,2,0,0,1,0,0]}","wincode":"07,08,10,11,03"},{"lotteryType":2007,"phase":"17060603","mvData":"{\"miss\":[0,2,1,1,1,1,0,0,0,0,3]}","wincode":"09,08,01,07,10"}]
     */

    private String errorcode;
    private String msg;
    /**
     * lotteryType : 2007
     * phase : 17060612
     * mvData : {"miss":[2,1,0,2,0,0,3,1,0,2,0]}
     * wincode : 03,09,05,06,11
     */

    private List<DataBean> data;

    public String getErrorcode() {
        return errorcode;
    }

    public void setErrorcode(String errorcode) {
        this.errorcode = errorcode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {
        private int lotteryType;
        private String phase;
        private String mvData;
        private String wincode;

        public int getLotteryType() {
            return lotteryType;
        }

        public void setLotteryType(int lotteryType) {
            this.lotteryType = lotteryType;
        }

        public String getPhase() {
            return phase;
        }

        public void setPhase(String phase) {
            this.phase = phase;
        }

        public String getMvData() {
            return mvData;
        }

        public void setMvData(String mvData) {
            this.mvData = mvData;
        }

        public String getWincode() {
            return wincode;
        }

        public void setWincode(String wincode) {
            this.wincode = wincode;
        }

        /**
         * 获取单期遗漏号码
         * @param label     字段名：miss,ge,shi,bai
         * @return
         */
      public String[] missNums(String label) {
            // TODO Auto-generated method stub
            String[] missNums = null;
            try {
                JSONObject obj = new JSONObject(mvData);
                String miss = obj.getString(label);
                miss =  miss.subSequence(1, miss.length()-1).toString();
                missNums = miss.split(",");
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return missNums;
        }
    }

    public static class LabelBean {
        public String label = "";
        public String showLabel = "";
        public Rect rect;
        public boolean isCheck = false;
        public int id = 0;

        public LabelBean(String label) {
            this.label = label;
            if (label.equals("bai")) {
                showLabel = "万位";
            }
            if (label.equals("shi")) {
                showLabel = "千位";
            }
            if (label.equals("ge")) {
                showLabel = "百位";
            }
        }

        public LabelBean(int id, String label, String showLabel) {
            this.id = id;
            this.label = label;
            this.showLabel = showLabel;
        }
    }
}
